package com.ruoyi.hospital.service.member.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.service.ISysAddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.hospital.mapper.member.MemberAddressMapper;
import com.ruoyi.hospital.domain.member.MemberAddress;
import com.ruoyi.hospital.service.member.IMemberAddressService;

/**
 * 会员收货地址Service业务层处理
 * 
 * @author wendao
 * @date 2024-12-25
 */
@Service
public class MemberAddressServiceImpl implements IMemberAddressService 
{
    @Autowired
    private MemberAddressMapper memberAddressMapper;


    /**
     * 查询会员收货地址
     * 
     * @param id 会员收货地址主键
     * @return 会员收货地址
     */
    @Override
    public MemberAddress selectMemberAddressById(Integer id)
    {
        return memberAddressMapper.selectMemberAddressById(id);
    }

    /**
     * 查询会员收货地址列表
     * 
     * @param memberAddress 会员收货地址
     * @return 会员收货地址
     */
    @Override
    public List<MemberAddress> selectMemberAddressList(MemberAddress memberAddress)
    {
        return memberAddressMapper.selectMemberAddressList(memberAddress);
    }

    @Override
    public List<MemberAddress> selectMemberAddressListByMemberId(Integer memberId) {
        return memberAddressMapper.selectMemberAddressListByMemberId(memberId);
    }

    /**
     * 新增会员收货地址
     * 
     * @param memberAddress 会员收货地址
     * @return 结果
     */
    @Override
    public int insertMemberAddress(MemberAddress memberAddress)
    {

        memberAddress.setCreateTime(DateUtils.getNowTimeSecond());
        return memberAddressMapper.insertMemberAddress(memberAddress);
    }

    /**
     * 修改会员收货地址
     * 
     * @param memberAddress 会员收货地址
     * @return 结果
     */
    @Override
    public int updateMemberAddress(MemberAddress memberAddress)
    {
        //解析省市区

        memberAddress.setUpdateTime(DateUtils.getNowTimeSecond());
        return memberAddressMapper.updateMemberAddress(memberAddress);
    }

    /**
     * 批量删除会员收货地址
     * 
     * @param ids 需要删除的会员收货地址主键
     * @return 结果
     */
    @Override
    public int deleteMemberAddressByIds(Integer[] ids)
    {
        return memberAddressMapper.deleteMemberAddressByIds(ids);
    }

    /**
     * 删除会员收货地址信息
     * 
     * @param id 会员收货地址主键
     * @return 结果
     */
    @Override
    public int deleteMemberAddressById(Integer id)
    {
        return memberAddressMapper.deleteMemberAddressById(id);
    }
}
